<template>
  <div class="company-list-1">
    <div class="header">
      <div class="prefix"></div>
      <div class="header-title">巡查员状态</div>
    </div>
    <div class="content">
      <div class="content-item" v-for="item in info">
        <div class="content-item-icon">
          <el-badge value="闲" class="item" v-if="item.state == '空闲中'">
            <el-avatar :size="50" shape="square" :src="formatImgUrl(item.waiterAvatar)" />
          </el-badge>
          <el-badge value="巡" class="item" color="green" v-else>
            <el-avatar shape="square" :size="50" :src="item.waiterAvatar" />
          </el-badge>
        </div>
        <div class="content-item-name">{{ item.waiterName }}</div>
      </div>
    </div>
  </div>
</template>

<script setup>
import { ref, onMounted, onUnmounted } from 'vue'
import svgIcon from '@/components/SvgIcon.vue'

const formatImgUrl = (url) => {
  return `${import.meta.env.VITE_IMG_URL}${url}?v=1.0`
}

const { info } = defineProps({
  info: Object
})
</script>

<style scoped lang="scss">
@import '@/assets/table.css';

.company-list-1 {
  padding: 10px;
  width: 100%;
  position: relative;
  display: flex;
  flex-direction: column;
  font-size: 16px;

  .header {
    width: 350px;
    height: 50px;
    display: flex;
    align-items: center;
    padding-left: 20px;

    .prefix {
      width: 8px;
      height: 15px;
      background-color: #31a7ff;
    }

    .header-title {
      padding-left: 10px;
    }
  }

  .content {
    height: 275px;
    overflow-y: auto;
    width: 100%;
    display: flex;
    flex-wrap: wrap;

    &-item {
      flex: 0 0 calc(17.9% - 10px);
      padding: 10px;
      display: flex;
      flex-direction: column;
      justify-content: flex-start;
      align-items: center;
      margin-bottom: 15px;

      &-icon {
        width: 50px;
        height: 50px;
        /* 设置背景图片覆盖整个元素 */
        background-size: cover;
        /* 设置背景图片居中 */
        background-position: center;
      }

      &-name {
        margin-top: 10px;
      }
    }
  }
}
</style>
